package com.example.schoolguider.service;

import com.example.schoolguider.mapper.AreaMapper;
import com.example.schoolguider.mapper.LayerMapper;
import com.example.schoolguider.model.Area;
import com.example.schoolguider.model.Layer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wjc
 * @date 2024/7/25 17:51
 */
@Service
public class AreaService {
    @Autowired
    AreaMapper areaMapper;
    @Autowired
    LayerMapper layerMapper;
    public List<Area> listAreas() {
        return areaMapper.listAreas();
    }

    public Area getAreaById(Long id) {
        return areaMapper.getAreaById(id);
    }

    public List<Layer> listLayer() {
        return layerMapper.listLayer();
    }

    public List<Layer> listLayerByAreaId(Long areaId) {
        return layerMapper.listLayerByAreaId(areaId);
    }

    public boolean updateArea(Area area) {
        return areaMapper.updateArea(area);
    }

    public boolean updateLayer(Layer layer) {
        return layerMapper.updateLayer(layer);
    }

    public boolean addLayer(Layer layer) {
        return layerMapper.addLayer(layer);
    }

    public Layer getLayerById(Long id) {
        return layerMapper.getLayerById(id);
    }
}
